//
//  GVMessageActivityView.m
//  GmallVIP
//
//  Created by yemeihua on 15/9/14.
//  Copyright (c) 2015年 yemeihua. All rights reserved.
//

#import "GVMessagePushView.h"

@implementation GVMessagePushView

- (instancetype)init
{
    if(self = [super init])
    {
        self.backgroundColor = [UIColor whiteColor];
        
        _typeImageView = [[UIImageView alloc] init];
        _typeImageView.contentMode = UIViewContentModeScaleAspectFill;
        _typeImageView.layer.masksToBounds = YES;
        [self addSubview:_typeImageView];
        
        _imageView = [[UIImageView alloc] init];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
        _imageView.layer.masksToBounds = YES;
        [self addSubview:_imageView];
        
        _typeLabel = [[UILabel alloc] init];
        _typeLabel.textColor = [UIColor yc_colorWithUInt:0x1a1a1a];
        _typeLabel.backgroundColor = [UIColor whiteColor];
        _typeLabel.font = [UIFont systemFontOfSize:21];
        _typeLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_typeLabel];
        
        _tipLabel = [[UILabel alloc] init];
        _tipLabel.textColor = [UIColor yc_colorWithUInt:0x00b4ff];
        _tipLabel.font = [UIFont systemFontOfSize:15];
        _tipLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:_tipLabel];
        
        [_typeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@0);
            make.top.equalTo(@0);
        }];
        
        [_typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(@0);
            make.right.equalTo(@0);
        }];
        
        [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@0);
            make.top.equalTo(_typeImageView.mas_bottom).offset(10);
            make.width.and.height.equalTo(@([GVMessagePushView widthForActivity]));
        }];
        
        [_tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@0);
            make.bottom.equalTo(@(-10));
        }];
    }
    return self;
}

+ (CGFloat)widthForActivity
{
    static CGFloat width = 0;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        width = 0.69 * kScreenWidth;
    });
    return width;
}

@end

@implementation GVMessagePushView0

- (instancetype)init
{
    if(self = [super init])
    {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = [UIColor blackColor];
        _titleLabel.backgroundColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont systemFontOfSize:16];
        _titleLabel.numberOfLines = 0;
        [self addSubview:_titleLabel];
        
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.imageView.mas_left);
            make.right.equalTo(self.imageView.mas_right);
            make.top.equalTo(self.imageView.mas_bottom).offset(14);
        }];
    }
    return self;
}

@end

@implementation GVMessagePushView1

- (instancetype)init
{
    if(self = [super init])
    {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = [UIColor blackColor];
        _titleLabel.backgroundColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont systemFontOfSize:16];
        _titleLabel.numberOfLines = 0;
        [self addSubview:_titleLabel];
        
        _contentLabel = [[UILabel alloc] init];
        _contentLabel.textColor = [UIColor yc_colorWithUInt:0x1a1a1a];
        _contentLabel.backgroundColor = [UIColor whiteColor];
        _contentLabel.numberOfLines = 0;
        [self addSubview:_contentLabel];
        
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.imageView.mas_left);
            make.right.equalTo(self.imageView.mas_right);
            make.top.equalTo(self.imageView.mas_bottom).offset(14);
        }];
        
        [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.titleLabel.mas_left);
            make.right.equalTo(self.titleLabel.mas_right);
            make.bottom.equalTo(self.tipLabel.mas_top).offset(-10);
        }];
    }
    return self;
}

@end

@implementation GVMessagePushView2

- (instancetype)init
{
    if(self = [super init])
    {
        _contentLabel = [[UILabel alloc] init];
        _contentLabel.textColor = [UIColor yc_colorWithUInt:0x1a1a1a];
        _contentLabel.backgroundColor = [UIColor whiteColor];
        _contentLabel.numberOfLines = 0;
        [self addSubview:_contentLabel];
        
        [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.imageView.mas_left);
            make.right.equalTo(self.imageView.mas_right);
            make.bottom.equalTo(self.tipLabel.mas_top).offset(-10);
        }];
    }
    return self;
}

@end

@implementation GVMessagePushView3

- (instancetype)init
{
    if(self = [super init])
    {
        
        _titleBgImageView = [[UIImageView alloc] init];
        _titleBgImageView.image = [UIImage imageNamed:@"msg_title_bg"];
        [self addSubview:_titleBgImageView];
        
        
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = [UIColor blackColor];
        _titleLabel.backgroundColor = [UIColor clearColor];
        _titleLabel.font = [UIFont systemFontOfSize:16];
        _titleLabel.numberOfLines = 0;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_titleLabel];
        
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.imageView.mas_left);
            make.right.equalTo(self.imageView.mas_right);
            make.top.equalTo(self.imageView.mas_bottom).offset(14);
        }];
        
        [_titleBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.equalTo(self.titleLabel);
            make.center.equalTo(self.titleLabel);
        }];
    }
    return self;
}

@end
